////////////////////////////////////////////////////////////////////////////////
// Copyright 2007 CORE Solutions Limited
// All rights reserved.
// PROPRIETARY AND CONFIDENTIAL INFORMATION.
// Use is subject to license terms.
//
// FUNCTION ID      :   CATALOG_SECURITY
// AUTHOR           :   Saint Peng
// DATE CREATE      :   2007/03/29
// DESCRIPTION      :   a PK file for the function, CATALOG_SECURITY
//                  :
//                  :
//                  :
//
// MODIFICATION HISTORY:
// DATE         AUTHOR          VERSION NO.         COMMENT
// -----------  --------------  ------------------  -------------------
// 2007/03/29   Saint Peng      1.0                 source is generated.
//
//
//
////////////////////////////////////////////////////////////////////////////////

package com.erp.app.catalog.catalogSecurity.pk;

import com.erp.framework.model.pk.SimpleSearchMaintStylePk;
import com.erp.framework.types.CustomBigInteger;

/**
* <p>A <strong>PK</strong>(Primay Key) stores the primary key which
* uniquely identifies each bean that is derived from database tables.
* A primary key can be a simple key, made up of a single attribute, or
* it can be a composite key, made up of a group of attributes from the bean.
* <br>
* As a suggested best practice, the PK class must implements the optional
* <code>java.lang.Object</code> methods, such as <code>equals</code> and
* <code>hashCode</code>
*
* @author          Saint Peng
* @version 1.0     2007/03/29
* @since           FrameWork 1.0
*
*/
public class CatalogSecurityFieldPk extends SimpleSearchMaintStylePk {

	public String companyCode;
	public String userCode;
	public String fieldDtlId;
	public String fieldNodeId;


	/**
	* Allocates and creates a new <code>Pk</code> that contains data from
	* the incoming parameters.
	*
	* @param      userId         the incoming user id
	* @param      fieldLineNo    the incoming line no
	* @param      itemDetailId   the incoming item detail id
	* @param      nodeId         the incoming node id
	* @author     Saint Peng
	* @since      Framework 1.0
	*/
	public CatalogSecurityFieldPk(String fieldNodeId, String companyCode, String userCode, String fieldDtlId) {
		this.companyCode = companyCode;
		this.userCode = userCode;
		this.fieldDtlId = fieldDtlId;
		this.fieldNodeId = fieldNodeId;
	}

	/**
	* Return a unique number representing the hash code for the
	* primary key instance.  Ensure that the hash code is indeed
	* unique when it is computed from the primary key attributes.
	* @return     the computed integer representing the primary key
	*
	* @author     Saint Peng
	* @since      Framework 1.0
	*/
	public int hashCode() {
		return (this.companyCode + this.userCode + this.fieldDtlId + this.fieldNodeId).hashCode();
	}

	/**
	* Properly evaluate the equality of two primary keys
	* by comparing values for each part of the composite key.
	* @param      obj     the primary key to compare this <code>String</code>
	*                     against.
	* @return     <code>true</code>     if the <code>primary keys</code> are equal;
	*             <code>false</code>    otherwise.
	*
	* @author     Saint Peng
	* @since      Framework 1.0
	*/
	public boolean equals(Object obj) {
		if (obj instanceof CatalogSecurityFieldPk) {
			CatalogSecurityFieldPk pk2 = (CatalogSecurityFieldPk) obj;
			return (this.companyCode != null && this.companyCode.equals(pk2.companyCode)
				&& this.userCode != null && this.userCode.equals(pk2.userCode)
				&& this.fieldDtlId != null && this.fieldDtlId.equals(pk2.fieldDtlId)
				&& this.fieldNodeId != null && this.fieldNodeId.equals(pk2.fieldNodeId));
		}
		return false;
	}

	/**
	* Converts to a string representing the data in this object.
	* A new <code>String</code> object is allocated and initialized to
	* contain the character sequence currently represented by this
	* object. This <code>String</code> is then returned. Subsequent
	* changes to this object do not affect the contents of the
	* <code>String</code>.
	*
	* @return     a string representation of the object.
	* @see        java.lang.Object#toString()
	* @author     Saint Peng
	* @since      Framework 1.0
	*/
	public String toString() {
		return "{companyCode = " + this.companyCode
				+ ", userCode = " + this.userCode
				+ ", fieldDtlId = " + this.fieldDtlId
				+ ", fieldNodeId = " + this.fieldNodeId + "}";
	}

	public String getCompanyCode() {
		return companyCode;
	}

	public String getFieldDtlId() {
		return fieldDtlId;
	}

	public String getFieldNodeId() {
		return fieldNodeId;
	}

	public String getUserCode() {
		return userCode;
	}

}
